<?php
declare (strict_types = 1);

namespace app\adminapi\controller\setting;

use adminmatrix\server\app\server\JsonService;
use app\adminapi\logic\setting\WebLogic;
use think\exception\HttpException;
use think\Request;
use adminmatrix\server\app\adminMatrix;
use think\response\Json;

class WebController extends AdminMatrix
{

    /**
     * 配置显示列表
     * @param Request $request
     * @param WebLogic $webLogic
     * @return Json
     */
    public function getWebSetting( Request $request , WebLogic $webLogic ) : Json
    {
        try{
            $webInfo = $webLogic->get($request);
            return JsonService::success('' , $webInfo);
        } catch (HttpException $e)
        {
            return JsonService::fail($e->getMessage());
        }
    }

    /**
     * 设置参数
     * @param Request $request
     * @param WebLogic $webLogic
     * @return Json
     */
    public function updateWebSetting (Request $request  , WebLogic $webLogic) : Json
    {
        try {
            $webLogic->set($request);
            return JsonService::success('更新成功');
        } catch (HttpException $e)
        {
            return  JsonService::fail($e->getMessage());
        }
    }

    /**
     * 插入参数
     */

    public function setConfig(){

    }
}
